// sd_liferuning/pages/constmer/balance-recharge/index.js
var api = require("../../../../api.js"), app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    money: 0,
    balance: 50,
    account: ""
  },
  changeInputData: function (e) {
    let that = this;
    let inputName = e.currentTarget.dataset.name;
    let inputVlaue = e.detail.value;
    if (inputName == "money") {
      that.setData({
        money: inputVlaue
      });
    }
    if (inputName == "account") {
      that.setData({
        account: inputVlaue
      });
    }

  },
  sendRequest: function () {
    let _this = this;
    let _money = _this.data.money;
    let _balance = _this.data.balance;
    let _account = _this.data.account;
    if (_account == "") {
      wx.showToast({
        title: '支付宝账号不得为空',
        icon: 'none'
      })
      return false;
    }
    if (_money > _balance || _money == "") {
      wx.showToast({
        title: '请正确填写金额',
        icon: 'none'
      })
      return false;
    }
    // TODO 执行请求
  },
  onLoad: function () {
    var that = this
    that.setData({
      icons: wx.getStorageSync('site') + '/addons/sd_liferuning/tp/public/uploads/background',
    })
  },

})
